<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/fetch-test-helpers.js"></script>
<script>
promise_test(function(t) {
    return fetch('../resources/doctype.html')
      .then(function() {}, t.unreached_func('must resolve'));
  }, 'fetch() with 200 should not output error messages');

promise_test(function(t) {
    return fetch('../resources/not-found.html')
      .then(function() {}, t.unreached_func('must resolve'));
  }, 'fetch() with 404 should not output error messages');

// Two didFail() errors
// that have console error messages from outside modules/fetch,
// and thus we OMIT messages from modules/fetch.
promise_test(function(t) {
    return fetch('../resources/redirect-loop.php?Count=100')
      .then(t.unreached_func('must reject'), function() {});
  }, 'net::ERR_TOO_MANY_REDIRECTS should not output error messages');

promise_test(function(t) {
    return fetch('../resources/slow-failure.cgi')
      .then(function() {}, t.unreached_func('must resolve'));
  }, 'net::ERR_INVALID_CHUNKED_ENCODING should not output error messages');

// A didFailAccessControlCheck() error
// that has NO console error messages from outside modules/fetch,
// and thus we OUTPUT a message from modules/fetch.
promise_test(function(t) {
    return fetch('http://localhost:8000/fetch/resources/doctype.html')
      .then(t.unreached_func('must reject'), function() {});
  }, 'A didFailAccessControlCheck() error should output an error message');

// A didFailRedirectCheck() error
// that has NO console error messages from outside modules/fetch,
// and thus we OUTPUT a message from modules/fetch.
promise_test(function(t) {
    return fetch('http://localhost:8000/fetch/resources/redirect-loop.php?Count=100&ACAOrigin=*')
      .then(t.unreached_func('must reject'), function() {});
  }, 'net::ERR_TOO_MANY_REDIRECTS (cross origin redirects) should not output error messages');
</script>
